package com.mz.ozy.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.jude.rollviewpager.adapter.StaticPagerAdapter;

import java.util.List;


/**
 */

public class BannerAdapter1 extends StaticPagerAdapter {

    List<Integer> mBannerListBeans;
    private Context mContext;
    public BannerAdapter1(Context context, List<Integer> mBannerListBeans) {
        this.mBannerListBeans  = mBannerListBeans;
        this.mContext = context;
    }

    @Override
    public View getView(final ViewGroup container, int position) {
        final List<Integer> bean = mBannerListBeans;

        RecyclerView recyclerView = new RecyclerView(container.getContext());
        recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
        recyclerView.setAdapter(new HomeSpikePageAdapter(mContext,bean));
      /*  view.setScaleType(ImageView.ScaleType.FIT_XY);
        view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        Glide.with(container.getContext()).load(bean.getImgPath()).crossFade().into(view);
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(!TextUtils.isEmpty(bean.getRef())){
                    if(bean.getRef().startsWith("http")){
                        Intent intent = new Intent(container.getContext(), WebBannerActivity.class);
                        intent.putExtra("url",bean.getRef());
                        mContext.startActivity(intent);

                    }else {
                        Intent intent = new Intent(mContext, ShopDetailActivity.class);
                        intent.putExtra("goodsId", bean.getRef());
                        intent.putExtra("menuId", 100);
                        mContext.startActivity(intent);
                    }

                }
            }
        });*/
        return recyclerView;
    }

    @Override
    public int getCount() {
        return mBannerListBeans.size();
    }

}
